﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Xml.Linq;


namespace EMOe
{
    public partial class Categories : PhoneApplicationPage
    {
        public Categories()
        {
            InitializeComponent();
        }

        private void okIcon_Click(object sender, System.EventArgs e)
        {
            this.NavigationService.GoBack();
        }

        private void ContentPanel_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
        	lstCategories.ItemsSource = (App.Current as App).c;
        }

        private void ToggleSwitch_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            (((ToggleSwitch)sender).DataContext as Category).cateSet = true;
        }

        private void ToggleSwitch_Unchecked(object sender, System.Windows.RoutedEventArgs e)
        {
            (((ToggleSwitch)sender).DataContext as Category).cateSet = false;
        }

        private void lstCategories_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            (App.Current as App).cString = (lstCategories.SelectedItem as Category).cateName;
            this.NavigationService.GoBack();
        }
    }
}
